package com.fsserver.core.mapper;

import com.fsserver.core.entity.PaymentTransaction;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 支付交易Mapper接口
 * Payment Transaction Mapper
 *
 * @author fsserver
 */
public interface PaymentTransactionMapper extends BaseMapper<PaymentTransaction> {

    /**
     * 根据交易号获取支付交易
     * Get payment transaction by transaction number
     *
     * @param transactionNo 交易号
     * @return 支付交易
     */
    PaymentTransaction getByTransactionNo(String transactionNo);

    /**
     * 根据第三方交易号获取支付交易
     * Get payment transaction by third-party transaction number
     *
     * @param thirdPartyTransactionNo 第三方交易号
     * @return 支付交易
     */
    PaymentTransaction getByThirdPartyTransactionNo(String thirdPartyTransactionNo);

    /**
     * 根据订单号查询支付交易列表
     * List payment transactions by order number
     *
     * @param orderNo 订单号
     * @return 支付交易列表
     */
    List<PaymentTransaction> listByOrderNo(String orderNo);

    /**
     * 根据状态查询支付交易列表
     * List payment transactions by status
     *
     * @param status 支付交易状态
     * @return 支付交易列表
     */
    List<PaymentTransaction> listByStatus(String status);

    /**
     * 根据用户ID查询支付交易列表
     * List payment transactions by user ID
     *
     * @param userId 用户ID
     * @return 支付交易列表
     */
    List<PaymentTransaction> listByUserId(Long userId);

    /**
     * 根据订单号关闭支付交易
     * Close payment transactions by order number
     *
     * @param orderNo 订单号
     * @return 影响行数
     */
    int closeTransactionsByOrderNo(@Param("orderNo") String orderNo);
} 